package com.china.great.system.controller;

import com.china.great.system.common.CommonResultUtil;
import com.china.great.system.service.SystemRoleService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: Liu HongYang
 * @DateTime: 2020/5/11 7:40 上午
 * @Description: TODO
 */
@RestController
@Api("博客相关的api")
@RequestMapping("/api/v1")
public class SystemRoleController {

    @Autowired
    private SystemRoleService systemRoleService;

    @RequestMapping(value = "/getRoleList", method = RequestMethod.GET)
    @ApiOperation(value="获取角色列表")
    @ApiImplicitParams({@ApiImplicitParam(name = "Authorization", value = "Authorization token", required = true, dataType = "string", paramType = "header")})
    public Object getList(@RequestParam(value="pageSize", defaultValue="20") int pageSize,
                          @RequestParam(value="pageNum", defaultValue="1") int pageNum){
        PageInfo list = systemRoleService.getRoleList(pageSize,pageNum);
        return CommonResultUtil.success(list);
    }

}
